import { createRouter, createWebHistory } from 'vue-router';

// 导入新组件
import Change from '@/components/change.vue';
import Homepage from '@/components/homepage.vue';
import ManageFile from '@/components/manage_file.vue';
import ManagePeople from '@/components/manage_people.vue';
import Menu from '@/components/menu.vue';
import Regist from '@/components/regist.vue';
import Rili from '@/components/rili.vue';
import Shouye from "@/components/shouye.vue";
import AuthorPage from '@/components/AuthorPage.vue';

const routes = [
  
  // 添加新路由
  {
    path: '/change',
    name: 'Change',
    component: Change
  },
  {
  path: '/homepage',
    name: 'Homepage',
    component: Homepage,
    children: [
  {
    path: 'manage-file',
    name: 'ManageFile',
    component: ManageFile
  },
  {
    path: 'manage-people',
    name: 'ManagePeople',
    component: ManagePeople
  },
      {
        path: 'rili',
        name: 'Rili',
        component: Rili
      },
      {
        path: 'shouye',
        name: 'Shouye',
        component: Shouye
      }
      ,
      {
    path: ':username',
    name: 'author-page',
    component: AuthorPage,
    props: true, // 允许将路由参数作为 props 传递给组件
  },
]},
  {
    path: '/menu',
    name: 'Menu',
    component: Menu
  },
  {
    path: '/regist',
    name: 'Regist',
    component: Regist
  },
]

const router = createRouter({
  history: createWebHistory(),  // 使用 history 模式的路由
  routes,  // 使用从 routes.js 导入的路由配置
});
/*导出模块*/
export default router;

